package com.mjlf.spring.entity;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @ClassName TestScope
 * @auther mjlf
 * @Date 2019/7/31 10:10
 * @Description 测试自定义Scope
 */
@Component
//自定义Scope测试
//@Scope("myScope")

@Scope("prototype")
public class TestScope1 {

    //自定义的不一定生效， 需要做额外的配置处理
    @PostConstruct
    public void initMethod(){
        System.out.println("TestScope1 init");
    }

    @PreDestroy
    public void destoryMethod(){
        System.out.println("TestScope1 destory");
    }

    public void test(){
        System.out.println("name1");
    }
}
